<template>
    <div>
        <hot-search>
            <span v-for="(value,index) in sdata.searchHot" :key="index" >
                 {{value.first}}
            </span>

        </hot-search>
        <search-history ref="searchHistory">
            <li v-for="(value,index) in sdata.history" :key="index">
            <p>{{value}}</p>
            <span v-on:click="selectItem(index)">x</span>
            </li>

        </search-history>
    </div>
</template>

<script>
    import searchHistory from '../searchHistory/searchHistory'
    import hotSearch from '../hotSearch/hotSearch'
    export default {
        props:['sdata'],
        // props可以跟数组也可以跟对象 数组可以直接用 跟对象一般是做配置使用 接口的暴露
        data () {
            return {}
        },

        methods: {
            selectItem(index){
                this.$refs.searchHistory.dellocalStoragel(index);
                this.$emit('getlocalStoragel')
            }
        },

        components: {
            searchHistory,
            hotSearch
        },
    }
</script>

<style scoped>
</style>